import sys


def inp() -> str:
    return sys.stdin.readline()


fa = []


def init(n: int):
    global fa
    fa = list(range(n + 1))


def find(x: int) -> int:
    if x == fa[x]:
        return x
    else:
        fa[x] = find(fa[x])
        return fa[x]


def merge(x: int, y: int) -> bool:
    x, y = find(x), find(y)
    if x == y:
        return False
    fa[x] = y
    return True


n, m = map(int, inp().split(" "))
init(n)
G = [[] for i in range(n)]
for i in range(m):
    x, y = map(int, inp().split(" "))
    G[x].append(y)
    G[y].append(x)
survive = [True] * n
q = int(inp())
query = [0] * q
for i in range(q):
    query[i] = int(inp())
    survive[query[i]] = False
s = 0
ans = []
for u in range(n):
    if survive[u]:
        s += 1
        for v in G[u]:
            if survive[v]:
                if merge(u, v):
                    s -= 1
ans.append(s)
for u in query[::-1]:
    s += 1
    survive[u] = True
    for v in G[u]:
        if survive[v]:
            if merge(u, v):
                s -= 1
    ans.append(s)
print("\n".join(map(str, ans[::-1])))
